package org.kailu.book.entity;
// default package
// Generated Jun 2, 2014 10:09:11 AM by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Proxy;

/**
 * Bill generated by hbm2java
 */
@Entity
@Proxy(lazy=false)
@Table(name = "bill", catalog = "book")
public class BillEntity implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer billId;
	private CustomerEntity customer;
	private Date billDate;
	private double billMoney;
	private Set<BillBookDetailsEntity> billBookDetailses = new HashSet<BillBookDetailsEntity>(
			0);
	private Set<BillStationeryDetailsEntity> billStationeryDetailses = new HashSet<BillStationeryDetailsEntity>(
			0);

	public BillEntity() {
	}

	public BillEntity(double billMoney) {
		this.billMoney = billMoney;
	}
	
	public BillEntity(CustomerEntity customerEntity, Date billDate) {
		this.customer = customerEntity;
		this.billDate = billDate;
	}

	public BillEntity(CustomerEntity customer, Date billDate, double billMoney,
			Set<BillBookDetailsEntity> billBookDetailses,
			Set<BillStationeryDetailsEntity> billStationeryDetailses) {
		this.customer = customer;
		this.billDate = billDate;
		this.billMoney = billMoney;
		this.billBookDetailses = billBookDetailses;
		this.billStationeryDetailses = billStationeryDetailses;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "bill_id", unique = true, nullable = false)
	public Integer getBillId() {
		return this.billId;
	}

	public void setBillId(Integer billId) {
		this.billId = billId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "customer_id")
	public CustomerEntity getCustomer() {
		return this.customer;
	}

	public void setCustomer(CustomerEntity customer) {
		this.customer = customer;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "bill_date", length = 10)
	public Date getBillDate() {
		return this.billDate;
	}

	public void setBillDate(Date billDate) {
		this.billDate = billDate;
	}

	@Column(name = "bill_money", nullable = false, precision = 22, scale = 0)
	public double getBillMoney() {
		return this.billMoney;
	}

	public void setBillMoney(double billMoney) {
		this.billMoney = billMoney;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "bill")
	public Set<BillBookDetailsEntity> getBillBookDetailses() {
		return this.billBookDetailses;
	}

	public void setBillBookDetailses(Set<BillBookDetailsEntity> billBookDetailses) {
		this.billBookDetailses = billBookDetailses;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "bill")
	public Set<BillStationeryDetailsEntity> getBillStationeryDetailses() {
		return this.billStationeryDetailses;
	}

	public void setBillStationeryDetailses(
			Set<BillStationeryDetailsEntity> billStationeryDetailses) {
		this.billStationeryDetailses = billStationeryDetailses;
	}

}
